package com.tanhua.server.controller;

import com.tanhua.server.service.PeachblossomService;
import com.tanhua.server.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * 桃花传音
 */
@RestController
@RequestMapping("peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;

    /**
     * 发送语音
     * @param soundFile
     * @return
     */
    @PostMapping
    public ResponseEntity sendPeachblossom(@RequestParam("soundFile") MultipartFile soundFile){
        peachblossomService.sendPeachblossom(soundFile);
        return ResponseEntity.ok(null);
    }

    /**
     * 接收语音
     * @return
     */
    @GetMapping
    public ResponseEntity querySound(){
        SoundVo soundVo = peachblossomService.querySound();
        return ResponseEntity.ok(soundVo);
    }

}
